home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HPAVC
/
HPAVC CD-ROM.iso
/
MCASM.RAR
/
MC_ASM.EXE
/
WROX_ASM
/
CH13
/
C13_2.TXT
< prev
next >
Wrap
Text File
|
1994-11-23
|
990b
|
52 lines
Program 13.2. Allocating memory blocks in upper memory
. . .
ptr1 dw 0
save_str dw 0
link_flag db 0
. . .
mov ax,5800h ; Get allocation strategy
int 21h
mov save_str,ax ; Save it
mov ax,5802h ; Get link flag
int 21h
mov link_flag,al ; Save it
mov bx,80h ; New strategy is First-fit-high
mov ax,5801h ; Set allocation strategy
int 21h
jc bad_strategy
mov bx,1 ; New link flag = on
mov ax,5803h ; Set it
int 21h
jc link_error
mov bx,625 ; Allocate 625 paragraphs
mov ah,48h
int 21h
jc alloc_err
mov ptr1,ax ; Store new segment address
; . . . ; Make use of it...
mov es,ptr1 ; Dispose of it
mov ah,49h
int 21h
jc free_error
mov bx,save_str ; Restore strategy
mov ax,5801h
int 21h
jc bad_strategy
mov ax,5803h ; Restore link flag
xor bx,bx
mov bl,link_flag
int 21h
jc link_error